package hk.edu.polyu.comp.motioncapture;

import hk.edu.polyu.comp.motioncapture.point.*;

public class Camera {
	private CoordinateOperation co;

	/**
	 * Create an camera object
	 * 
	 * @param point -
	 *            Accept Point Recognition
	 * @param sound -
	 *            Accept Speech Recognition
	 */
	public Camera(boolean point, boolean sound, Screen screen) {
		co = new CoordinateOperation(point, sound, screen);
	}

	/**
	 * The result is true if and only if the camera is running
	 * 
	 * @return true if the camera is running; false otherwise.
	 */
	public boolean isRunning() {
		return co.isRunning();
	}

	/**
	 * Stop the camera
	 */
	public void stopCamera() {
		co.stopCarema();
	}

	/**
	 * Start the camera
	 */
	public void run() {
		co.start();
	}

	/**
	 * Print out all the point from the beginning to current.
	 */
	public void printAllPoints() {
		co.printAllResult();
	}

	/**
	 * Return the point set of all the point from the beginning to current.
	 * 
	 * @return a frameset storing all the result point set.
	 */
	public FrameSet returnAllPointSets() {
		return co.returnAllResult();
	}

	/**
	 * Return the point set of all the point within a period of time.
	 * 
	 * @param second
	 *            The period of time that the point will be returned.
	 * @return a frameset storing all the result point set.
	 */
	public FrameSet returnTimePointSets(double second) {
		return co.returnTimeResult(second);
	}

	/**
	 * Return the point set of all the point within a period of time.
	 * 
	 * @param second
	 *            The period of time that the point will be returned.
	 * @return Vector<Vector<OptiPoint>> - A 3D Vector storing all the result
	 *         point set.
	 */
	public FrameSet returnFramePointSets(int noOfFrame) {
		return co.returnFrameResult(noOfFrame);
	}

	public FrameSet[] returnLastResultDividedByHoz(double second,
			int precentage, Screen screen) {
		return co.returnLastResultDividedByHoz(second, precentage, screen);
	}

	/**
	 * 
	 * @return
	 */
	public Frame returnFirstPointSet() {
		return co.returnFirstResult();
	}

	public Frame returnLastPointSet(boolean returnRepeat) {
		return co.returnLastResult(returnRepeat);
	}

	public Frame returnNextPointSet() {
		return co.returnNextResult();
	}

	public int getFPS() {
		return co.getFPS();
	}

	public int getAverageFPS() {
		return co.getAverageFPS();
	}

	public int getRunTime() {
		return co.getRunTime();
	}

	public boolean hasSoundCommand() {
		return co.hasSoundCommand();
	}

	public String getSoundCommand() {
		return co.getSoundCommand();
	}
}
